import { ref, onMounted } from "vue";

export default function useMousePoint() {
  //获取鼠标位置的:保存的数据
  const x = ref(-1);
  const y = ref(-1);
  //获取鼠标位置的:事件函数
  const getMousePoint = (e: MouseEvent) => {
    x.value = e.clientX;
    y.value = e.clientY;
  };
  //获取鼠标位置的:生命周期函数
  onMounted(() => {
    console.log("请移动鼠标,可以查看鼠标的位置信息");
  });

  return { x, y, getMousePoint };
}
